﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace T13_运算符重载
{
    class Program
    {
        static void Main(string[] args)  
        {
            gamevalue gv = new gamevalue();
            gv.Hp = 10;
            gv.Mp = 11;
            gv.Sp = 12;
            gamevalue gv1 = new gamevalue();
            gv1.Hp = 13;
            gv1.Mp = 14;
            gv1.Sp = 15;
            gamevalue gv2 = new gamevalue();
            gv2 = gv + gv1;
        }
    }
    class gamevalue
    {
        private int hp;
        private int mp;
        private int sp;

        public int Hp
        {
            get { return hp; }
            set { hp = value; }
        }

        public int Mp  
        {
            get { return mp; }
            set { mp = value; }
        }

        public int Sp
        {
            get { return sp; }
            set { sp = value; }
        }
        public static gamevalue operator +(gamevalue a,gamevalue b)
        {
            gamevalue gv = new gamevalue();
            gv.hp = a.hp + b.hp;
            gv.mp = a.mp + b.mp;
            gv.sp = a.sp + b.sp;
            return gv;
        }
    }
}
